package com.xiaoger.mybatis.controller;

import com.xiaoger.mybatis.entity.User;
import com.xiaoger.mybatis.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xjx
 * @date 2022/5/16 20:56
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;


    @GetMapping("/getById")
    public String getUserById(@RequestParam(value = "id") Integer id){
        User user = userService.findById(id);
        return user.getName();
    }
}
